package linuxbox.admin.logic;

import java.sql.Date;
import java.util.*;

public class User {
    private Integer m_iID;
    private String m_sLoginID;
    private String m_sFirstName;
    private String m_sLastName;
    private String m_sPassword;
    private long m_lUserRights;
    private long m_lUserRights2;
    private Date m_dtBeginDate;
    private Date m_dtEndDate;
    private ContactInfo contact = null;
    private int m_iManagerID;
    private int m_iDeptID;
    private String m_sDeptName;
    private boolean m_bIsManager;
    private boolean m_bDisable;
    private boolean m_bNoExpire;
    private String m_sNote;

    /**
     * a list of groups to which this user belongs
     */
    private Set groupSet = new HashSet();
    
    public User() {
    	
    }
    
    public User(String login, String password, String firstname, 
                String lastname, long rights, long rights2, 
                boolean noexpire) {
        m_sLoginID = login;
        m_sPassword = password;
        m_sFirstName = firstname;
        m_sLastName = lastname;
        m_lUserRights = rights;
        m_lUserRights2 = rights2;
        m_bNoExpire = noexpire;

        m_dtBeginDate = null;
        m_dtEndDate = null;
        m_iManagerID = -1;
        m_iDeptID = -1;
        m_bIsManager = false;
        m_bDisable = false;
        m_sNote = null;
    }
	
    public User(int userid, String login, String password, String firstname, 
                String lastname, long rights, long rights2, boolean noexpire) {
        m_iID = new Integer(userid);
        m_sLoginID = login;
        m_sPassword = password;
        m_sFirstName = firstname;
        m_sLastName = lastname;
        m_lUserRights = rights;
        m_lUserRights2 = rights2;
        m_bNoExpire = noexpire;

        m_dtBeginDate = null;
        m_dtEndDate = null;
        m_iManagerID = -1;
        m_iDeptID = -1;
        m_bIsManager = false;
        m_bDisable = false;
        m_sNote = null;
    }

    public int getID() {
        return m_iID.intValue();
    }

    public void setID(int id) {
        m_iID = new Integer(id);
    }

    public String getLoginID() {
        return m_sLoginID;
    }

    public void setLoginID(String login) {
        m_sLoginID = login;
    }

    public String getPassword() {
        return m_sPassword;
    }
	
    public void setPassword(String password) {
        m_sPassword = password;
    }
	
    public String getFirstName() {
        return m_sFirstName;
    }
	
    public void setFirstName(String firstname) {
        m_sFirstName = firstname;
    }
	
	
    public String getLastName() {
        return m_sLastName;
    }
	
    public void setLastName(String lastname) {
        m_sLastName = lastname;
    }
	
    public long getUserRights() {
        return m_lUserRights;
    }
	
    public void setUserRights(long rights) {
        m_lUserRights = rights;
    }

    public long getUserRights2() {
        return m_lUserRights2;
    }
	
    public void setUserRights2(long rights2) {
        m_lUserRights = rights2;
    }

    public Date getBeginDate() {
        return m_dtBeginDate;
    }
	
    public void setBeginDate(Date dt) {
        m_dtBeginDate = dt;
    }

    public Date getEndDate() {
        return m_dtEndDate;
    }
	
    public void setEndDate(Date dt) {
        m_dtEndDate = dt;
    }

    public ContactInfo getContact() {
        return contact;         
    }
    
    public void setContact(ContactInfo c) {
    	contact = c;
    }
    
    public String getAddress() {
        return contact.getAddress();
    }
	
    public void setAddress(String address) {
        contact.setAddress(address);
    }
	
    public String getCity() {
        return contact.getCity();
    }
	
    public void setCity(String city) {
        contact.setCity(city);
    }
	
    public String getState() {
        return contact.getState();
    }
	
    public void setState(String state) {
        contact.setState(state);
    }
		
    public String getZipCode() {
        return contact.getZipCode();
    }
	
    public void setZipCode(String zip) {
        contact.setZipCode(zip);
    }
	
    public String getPhone() {
        return contact.getPhone();
    }	
	
    public void setPhone(String phone) {
        contact.setPhone(phone);
    }
	
    public String getFax() {
        return contact.getFax();
    }
	
    public void setFax(String fax) {
        contact.setFax(fax);
    }
	
    public String getMobile() {
        return contact.getMobile();
    }
	
    public void setMobile(String mobile) {
        contact.setMobile(mobile);
    }
	
    public String getEmail() {
        return contact.getEmail();
    }
	
    public void setEmail(String email) {
        contact.setEmail(email);
    }
	
    public int getManagerID() {
        return m_iManagerID;
    }
	
    public void setManagerID(int id) {
        m_iManagerID = id;
    }
	
    public int getDeptID() {
        return m_iDeptID;
    }
	
    public void setDeptID(int id) {
        m_iDeptID = id;
    }
	
    public String getDeptName() {
        return m_sDeptName;
    }
	
    public void setDeptName(String str) {
        m_sDeptName = str;
    }
	
    public boolean getIsManager() {
        return m_bIsManager;
    }
	
    public void setIsManager(boolean isManager) {
        m_bIsManager = isManager;
    }

    public boolean getDisable() {
        return m_bDisable;
    }
	
    public void setDisable(boolean dis) {
        m_bDisable = dis;
    }

    public boolean getNoExpire() {
        return m_bNoExpire;
    }
	
    public void setNoExpire(boolean noe) {
        m_bNoExpire = noe;
    }

    public String getNote() {
        return m_sNote;
    }
	
    public void setNote(String note) {
        m_sNote = note;
    }

    public Set getGroupSet() {
        return groupSet;
    }
    
    public void setGroupSet(Set gs) {
        groupSet = gs;
    }
    
    public String toString() {
        StringBuffer sb = new StringBuffer();
        sb.append("id=" + m_iID + "\n");
        sb.append("loginid=" + m_sLoginID + "\n");
        sb.append("firstname=" + m_sFirstName + "\n");
        sb.append("lastname=" + m_sLastName + "\n");
        sb.append("password=" + m_sPassword + "\n");
        sb.append("rights=" + m_lUserRights + "\n");
        sb.append("rights2=" + m_lUserRights2 + "\n");
        sb.append("group=" + groupSet + "\n");
        
        return sb.toString();
    }
    
    public void debug(Object obj) {
    	System.out.println("From User: " + obj);
    }
}